/*******************************************OVERVIEW*******************************************************
 
 Political Shocks and Asset Prices
 
 Replication do file
 
 Code to Estimate Volatility Ratios
 
 Version July 9 2021 
 
  
********************************************************************************************************************/


clear
set more off
#delimit ;

/*Set Directory -- You will need to adjust this line of code accordingly */; 

cd "/Users/ssaiegh/Files/Mac/UCSD/Carnahan/Shocks/Replication Files";

/*Create Log File*/;

log using "Appendix C", replace text;

/*Load Data File*/;

use "results_sp_argentina_2020.dta";

gen dec_1970=(year<1980);
gen dec_1980=(dec_1970==0 & year<1990);
gen dec_1990=(dec_1970==0 & dec_1980==0 & year<2000);
gen dec_2000=(dec_1970==0 & dec_1980==0 & dec_1990==0 & year<2010);
gen dec_2010=(dec_1970==0 & dec_1980==0 & dec_1990==0 & dec_2000==0 & year>2009);

gen decade=(dec_1970);
replace decade=2 if dec_1980==1;
replace decade=3 if dec_1990==1;
replace decade=4 if dec_2000==1;
replace decade=5 if dec_2010==1;

egen n_events=count(case_id) if event==1 & terror==0, by(decade);

keep if event==1 & terror==0;

sum ratio_dol;

collapse (mean) meanfu=ratio_dol (sem) sdfu=ratio_dol (mean) meann=n_events, by(decade);
generate hifu = meanfu + 1.28 *(sdfu);
generate lofu = meanfu - 2.26 *(sdfu);

log c;
